


import datetime
now = datetime.datetime.now()
print(now)

now = datetime.datetime.now()  # 当前时间
old = now - datetime.timedelta(minutes=30)  # 30分钟前
print("当前时间%s,过去时%s" %(now,old))



beginDate = old.strftime('%Y%m%d%H%M%S')
endDate = now.strftime('%Y%m%d%H%M%S')  # 3分钟一次查询
print(beginDate,endDate)

#
# BEFORE_MINS = -10
# # 10分钟前
# print(now)
# print(now+ datetime.timedelta(seconds=BEFORE_MINS))
#

# 2019-05-15T20:00:00.000+0800



import datetime
now = datetime.datetime.now()
print(now)

now = datetime.datetime.now()  # 当前时间
old = now - datetime.timedelta(minutes=30)  # 30分钟前
print(old.strftime('%Y-%m-%dT%H:%M:%S.000+0800'))
print(now.strftime('%Y-%m-%dT%H:%M:%S.000+0800'))
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))